Repository navigation
feat(kodecs-h264)!: parse 0.1's scope again and check decoder scope apart - #118
Conversation
Quest-Claim: 6d3343afd903efa2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…erges Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 17 minutes. View limit details
No actionable comments were generated in the recent review. WalkthroughThe kodecs-h264 relicense entry changes its size label from Merge Risk:
|
|
Maintainer decision (via /quest-run, 2026-12-03): extend kodecs-h264 instead of narrowing MPEG-TS import. kodecs-h264's parser regains everything the 0.1 (cros-codecs-derived) parser parsed, including interlaced/field slice headers and picture order count, so moq-mux keeps deriving H.264 timestamps for those streams (rejected: accepting the narrower scope; keeping a slice-header parser in moq-mux). The decoder scope stays progressive 8-bit 4:2:0, and VA-API H.264 decode still refuses interlaced. This PR waits for the kodecs-h264 release carrying that, then moves onto it. (Written by Claude Opus 5.5) |
…part The parser takes interlaced and MBAFF sequences (field_pic, bottom_field, the per-field picture order count fields), 4:0:0 through 4:4:4 with the 4:4:4 scaling lists, bit depths up to 14, transform bypass, SP and SI slices, data partition A, and streams over their level's DPB and side limits. It still bounds its own work by the level's frame size and NAL budget, using level 6.2's for levels Table A-1 lacks. Sps::check_decoder_scope holds what the decoders take: progressive 8-bit 4:2:0 within its level. kodecs-vaapi runs it on every SPS and slice and refuses data partitioning and SP/SI slices. Slice headers are checked against ffmpeg's trace_headers reading of each fixture, to the bit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # kodecs-vaapi/CHANGELOG.md
|
Applied at 96f39d9:
The PR body's Decisions and Validation sections have the details. (Written by Claude Opus 5.5 with high) |
…s it Storing a 4:4:4 SPS made the parser read each PPS naming its id again with twelve scaling lists and drop those coded for 4:2:0, so a stream coming back to its sequence without resending its PPS failed. The decoder now checks scope first and remembers the refused id. Also corrects docs the review found stale: the field MMCO bound, the level 6.2 fallback's reach, pic_init_qp's range, partition A's slice_id, and data partitions B and C among what the parsers refuse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Maintainer decision (via /quest-run, 2026-12-04): resolve the open review finding (stale NAL budget after a refused SPS) by redesigning instead of patching. kodecs-h264 keeps one full-syntax (Written by Claude Opus 5.5) |
…d against
The parser stores every SPS it reads, in a decoder's scope or not, so its NAL
budget follows the sequence the stream sent. Unit::Sps and Unit::Pps carry the
stored Arcs, and Unit::Slice { header, sps, pps } the ones its header used. A
PPS the replacing SPS can't read keeps its RBSP for the next SPS that can.
kodecs-vaapi checks Sps::check_decoder_scope on each slice's SPS, cached by Arc
pointer, and drops its SPS pre-parse, refused-id bitmask, per-slice id lookups
and deep clones of the parameter sets.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Unit::Slice carries the slice's NaluHeader, so a decoder using Parser::next can refuse data partition A. kodecs-vaapi gives parser errors a neutral context instead of the decoder-scope text, and the changelog marks the new public fields breaking. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…p its slices.tsv #118 added streams beyond the decoder's scope to the tests/data the corpus replay reads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings kodecs-h264's parser back to 0.1's scope, written clean-room, and moves the decoders' narrower scope into
Sps::check_decoder_scope, which a decoder checks on theArc<Sps>each slice now carries. This applies the maintainer decisions on scope and the parser API. The relicense quest becomes moq-dev/moq moving onto the kodecs-h264 release that carries this.Changes
chroma_format_idc(4:0:0 through 4:4:4),separate_colour_plane, luma and chroma bit depth up to 14,qpprime_y_zero_transform_bypass,frame_mbs_onlyandmb_adaptive_frame_field. Also covers 4:4:4's twelve scaling lists with their fall-back rule, and crop units byChromaArrayType.colour_plane_id,field_picandbottom_field.delta_pic_order_cnt_bottomanddelta_pic_order_cnt[1]are read only for frames. Thefirst_mb_in_slicelimit is halved for fields and MBAFF, up to 32 references per list in fields, andMaxPicNumis doubled. MMCO counts are bounded for fields,slice_qpbyQpBdOffsetY, and SP/SI slices readsp_for_switchandslice_qs. There is no chroma in the weight table whenChromaArrayTypeis 0.Unsupported.max_dec_frame_bufferinglimits move tocheck_decoder_scope.Parserwith no scope mode stores every parameter set it parses, so its NAL budget follows the SPS the stream sent.Unit::Sps/Unit::Ppscarry the storedArc<Sps>/Arc<Pps>, andUnit::Slice { nal, header, sps, pps }its NAL header and theArcs its header parsed against.Parser::sps(id)/pps(id)stay read-only. A PPS the replacing SPS can't read (such as 4:2:0 scaling lists under a 4:4:4 SPS) keeps its RBSP until an SPS that reads it arrives, so a stream returning to its earlier sequence needn't resend it. The Verus proofs cover theArcstorage on the pinned Verus as is.Sps::check_decoder_scopereturnsUnsupportedoutside progressive 8-bit 4:2:0 without transform bypass, andLevel/Rangeoutside its level. kodecs-vaapi checks it on each slice'sArc<Sps>, caching the last passing SPS by pointer, and refuses the slice; decoding resumes once the stream sends an in-scope SPS. It also refuses data partitioning and SP/SI slices, so it still decodes only what it did. It drops itsSps::parsepre-check, itsrefusedbitmask, its per-slicepps(header.pps_id).sps_idlookup,parameter_sets()and its per-slice deep clones of the SPS and PPS.tests/scope.rschecks 210 slice headers against ffmpeg'strace_headersreading (tests/data/slices.tsv), to the bit.Arcs are the stored sets.check_decoder_scopefails on that slice's SPS; switching back parses slices without a resent PPS. A PPS a 4:4:4 SPS can't read returns with its sequence.relicense.mdwaits on the kodecs-h264 release, then on chore(mux,video): move to kodecs-h264 0.2 and kodecs-vaapi 0.2.1 moq#10499 moving onto it and merging. It is resized to S.Public API impact
Breaking for kodecs-h264 (
!). Details are inkodecs-h264/MIGRATE.md("kodecs-h264 0.2 -> 0.3").Unit::Sps(Arc<Sps>),Unit::Pps(Arc<Pps>)andUnit::Slice { nal, header, sps, pps }replace the id-carrying variants andUnit::Slice(SliceHeader).Parser::sps/ppsreturnOption<&Arc<_>>.SpsandSliceHeader, and newSliceType::Sp/Sivariants. Exhaustive matches and struct literals need updating.UnsupportedorLevelnow parse. CallSps::check_decoder_scopeon each slice's SPS to keep refusing them.scaling::Matrix::lists_8x8holds 6 lists in 4:4:4.kodecs-vaapi's API is unchanged, and so is the behavior it decodes. No wire format changes.
Decisions
encode::probe's signature change.check_decoder_scope. Unknown levels parse under level 6.2's limits rather than failing.scaling::Matrix::lists_8x8changes length (128 or 384) rather thanPps::writetaking the SPS.direct_8x8_inference"shall" check for field-capable SPSs, matching 0.1.Parserthat always stores what it parses,Unit::Slicecarrying itsArc<Sps>/Arc<Pps>(andUnit::Sps/Unit::Ppstheirs), read-onlysps(id)/pps(id), and decoders checkingcheck_decoder_scopeper slice SPS cached byArcpointer (rejected:Parser::forget_sps(id); aScopeenum or check fn inParser::new; two parser types; accepting Codex's stale-budget finding as is). This settles the former## Waitingitem and supersedes the round-1 agent decision that kept refused SPSs out of the parser.Unit::Sliceis a struct variant{ nal, header, sps, pps }rather than a newSlicetype, so a decoder destructures it without another public name. It keeps theNaluHeaderso a decoder usingParser::nextcan refuse data partition A (review round 1, Codex).parse a {type} NAL unitcontext, keeping the decoder-scope text forcheck_decoder_scoperefusals, since the parser's remainingUnsupportedcases are slice groups, partitions B/C and extensions (review note).check_decoder_scope'su32multiply on a hand-builtSpspast the parser's 1055-macroblock bound, its use of the storedmax_dpb_frameson an editedSps, the writers not boundingcolour_plane_id/chroma_format_idc/bit depths, andPps::writesizing 8x8 lists from the matrix. Each needs a caller hand-building out-of-spec values.seq_parameter_set_id) and reportsMissingfor its slices, rather than being dropped. Without it, a 4:4:4 SPS would cost the 4:2:0 sequence it interrupts its scaled PPS, which the hardware testa_pps_outlasts_a_sequence_that_cant_read_itcovers.#[allow(clippy::large_enum_variant)]onUnitwith a reason, rather than boxing the header, since a unit is moved out as soon as it's returned.Arcconcern was a non-issue: vstd at the pinned version specifiesArc::newandArc::clone, and the proofs verify with no helper. OnlyUnit's derivedCloneneededverifier::allow(autoderive_clone_without_spec), as no proof clones a unit.Validation
nix develop --command just cionfedora(Linux) at 171a24b: lint, format, tests, and Verus (130 verified, 0 errors).just vaapionfedora(AMD renderD128) at 171a24b: 35 passed, includingsequences_outside_the_scope_are_refused,a_refused_sequence_resumes_once_sent_again, anda_pps_outlasts_a_sequence_that_cant_read_it.cargo test -p kodecs-h264on Windows passed.slice_headers_match_ffmpeg) fails when the!field_picgating of the bottom POC fields is removed (earlier round; the slice parser is unchanged here).[patch.crates-io]for kodecs-h264 and kodecs-vaapi:cargo clippy -p moq-mux -p moq-video --all-targets --features moq-video/vaapi -- -D warningsclean, andcargo nextest run2522 passed, 9 skipped. That needed two local changes, held until kodecs-h264 publishes: moq-mux's MPEG-TS clock takes the SPS fromUnit::Slice { header, sps, .. }instead of two id lookups, and moq-video's VA-API encoder buildsencode::ConfigthroughConfig::new, sincemain's unreleased kodecs-vaapi made it#[non_exhaustive].quest check: ok.quest review(level L, run onfedorasince Codex's sandbox can't run on native Windows), two rounds to 171a24b. Round 1: Codex gpt-6.2-sol xhigh scored 6 with one finding (keep the NAL type on parsed slices), fixed; Claude Opus 5.5 high scored 8 with notes only. Round 2: Codex 10, Claude 9, no findings.Follow-ups
None. moq-side work (restoring field POC on top of the release) is tracked by
quest/m1/kodecs-h264/relicense.md.Models
Size: M
Implementer: claude, claude-opus-5-5, high (writer A/B arm A, cohort m-writer-effort)
Implementer: claude, claude-opus-5-5, high (iterate, M, arm A, cohort m-writer-effort)
Implementer: claude, claude-opus-5-5, high (iterate, M, arm A, cohort m-writer-effort)
🤖 Generated with Claude Code
(Written by Claude Opus 5.5 with high)